package display.renderer;

import java.awt.geom.Point2D;

import display.structure.Wheel;

import prefuse.Constants;
import prefuse.render.EdgeRenderer;
import prefuse.visual.EdgeItem;
import weeny.pre.util.Geom;

public class CircleEdgeRender extends EdgeRenderer{
	private Wheel wheel = null;
	public CircleEdgeRender(Wheel wheel) {
		this.wheel = wheel;
		this.setEdgeType(Constants.EDGE_TYPE_CURVE);
		this.setArrowType(Constants.EDGE_ARROW_NONE);
	}
	@Override
	protected void getCurveControlPoints(EdgeItem eitem, Point2D[] cp,
			double x1, double y1, double x2, double y2) {
		cp[0].setLocation(Geom.toPntFracBetween(eitem.getSourceItem(), 0.7, wheel.center));
		cp[1].setLocation(Geom.toPntFracBetween(eitem.getTargetItem(), 0.7, wheel.center));
	}
}
